/*! \file BufferImpl.h
 *	\brief <write description for BufferImpl.h>
 *
 *	created:	2010/12/12
 *	created:	12:12:2010   20:35
 *	filename: 	C:\src\tactics-engine\libs\gd\BufferImpl.h
 *	file path:	C:\src\tactics-engine\libs\gd
 *	file base:	BufferImpl
 *	file ext:	h
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#ifndef _gd_BUFFERIMPL_H_
#define _gd_BUFFERIMPL_H_

#pragma once

namespace tt{
namespace gd{

class DeviceContext;

class BufferImpl
{
public:
	BufferImpl();
	virtual ~BufferImpl();

	void lock(DeviceContext*);
	void unlock(DeviceContext*);

	UInt size() const;
	void* data();

	void apply(DeviceContext*);

protected:
	void setSize(UInt size);
	void setData(void* data);

protected:
	virtual void onLock(DeviceContext*) = 0;
	virtual void onUnlock(DeviceContext*) = 0;

	virtual void onApply(DeviceContext*) = 0;

private:
	UInt m_size;
	void* m_data;
};

} //namespace gd
} //namespace tt
#include "BufferImpl.inl"

#endif //_gd_BUFFERIMPL_H_